#ifndef _GBUFFER_H_
#define _GBUFFER_H_
#include <unordered_map>
#include <memory>
#include <string>
#include <SERender/Resourses/Texture.h>

namespace SEngine
{
    class GBuffer
    {
    public:
        GBuffer();
        virtual ~GBuffer() = default;
        void AddRenderTarget(const std::string & name, std::unique_ptr<Texture2D> && target);
        std::shared_ptr<Texture2D> operator[](const std::string & name);
        template<typename Fn>
        void Foreach(Fn && fn) {
            for (auto & [name, tex] : m_renderTargets) {
                fn(name, tex);
            }
        }
    private:
        std::unordered_map<std::string, std::shared_ptr<Texture2D>> m_renderTargets;

    };
} // namespace SEngine


#endif